package com.mtwp.dfs.repository;

import com.mtwp.dfs.domain.category.DiskStore;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface DiskStoreRepository extends JpaRepository<DiskStore, Integer>, JpaSpecificationExecutor<DiskStore> {

//    List<DiskStore> findAllByNameLike(String name);
//
//    List<DiskStore> findAllByNameLikeAndLevel(String name,Integer level);
//
//    List<DiskStore> findAllByPathCodeLike(String pathCode);

    @Modifying
    @Query(nativeQuery = true,value = "UPDATE dfs_diskstore set status = -1 WHERE id in ?1 AND status IN ?2")
    void updateDiskStoreStatus(List<Integer> ids);


    List<DiskStore> findAllByIdInAndStatusInAndDownloadUrlNotNull(List<Integer> ids,List<Integer> statusList);

}
